1 <?php
2 session_start();
// Use session variable on this page. This function must put on the top of page.
3 if
(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
4 header(
"location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
5 }

6 else

7 {
8     include_once
"db.php";
9     error_reporting (E_ALL ^ E_NOTICE);
10     
if(isset($_GET['sid']))
11     {
12 ?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
13 <html xmlns=
"http://www.w3.org/1999/xhtml">
14 <head>
15 <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1" />
16 <title>Sales Print</title>
17 <style type=
"text/css" media="print">
18 .hide{display:none}
19
20 </style>
21 <script type=
"text/javascript">
22 function printpage() {
23 document.getElementById(
'printButton').style.visibility="hidden";
24 window.print();
25 document.getElementById(
'printButton').style.visibility="visible";
26 }
27 </script>
28 <style type=
"text/css">
29 <!--
30 .style1 {font-size: 10px}
31 -->
32 </style>
33 </head>
34
35 <body>
36 <input name=
"print" type="button" value="Print" id="printButton" onClick="printpage()">
37 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
38   <tr>
39     <td align=
"center" valign="top">
40     
41     <table width=
"595" cellspacing="0" cellpadding="0" id="bordertable" border="1">
42       <tr>
43         <td align=
"center"><strong>Sales Receipt <br />
44         </strong>
45           <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
46             <tr>
47               <td width=
"67%" align="left" valign="top">&nbsp;&nbsp;&nbsp;Date: <?php
48               $sid=$_GET[
'sid'];
49             $line = $db->queryUniqueObject(
"SELECT * FROM stock_sales WHERE transactionid='$sid' ");
50             
51             $mysqldate=$line->date;
52
53         $phpdate = strtotime( $mysqldate );
54
55         $phpdate = date(
"d/m/Y",$phpdate);
56         echo $phpdate;
57               ?> <br />
58                 <br />
59                 <strong><br />
60                 &nbsp;&nbsp;&nbsp;Receipt No: <?php echo $sid;
61                 
62                  ?> </strong><br /></td>
63               <td width=
"33%"><div align="center"><span class="style1">Sri Veeru Nagammal Thunai</span> <br />
64                   <strong>N. U &amp; Sons Fertilizer </strong><br />
65                   No.
740, Thiruvallur Road, <br />
66                   Thamaraipakkam Koot Road<br />
67                   Pin -
601 103<br />
68               </div></td>
69             </tr>
70           </table></td>
71       </tr>
72       <tr>
73         <td height=
"90" align="left" valign="top"><br />
74           <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
75             <tr>
76               <td width=
"5%" align="left" valign="top"><strong>&nbsp;&nbsp;TO:</strong></td>
77               <td width=
"95%" align="left" valign="top"><br />
78               <?php
79                 echo $line->customer_id;
80                 $cname=$line->customer_id;
81                 
82                 $line2 = $db->queryUniqueObject(
"SELECT * FROM customer_details WHERE customer_name='$cname' ");
83                 
84                 echo $line2->customer_address;
85                 ?>
86                 <br />
87                 <?php
88                 echo
"Contact1: ".$line2->customer_contact1."<br>";
89                 echo
"Contact1: ".$line2->customer_contact2."<br>";
90                     
91                 
92                 ?></td>
93             </tr>
94           </table></td>
95       </tr>
96       <tr>
97         <td><table width=
"100%" border="0" cellspacing="0" cellpadding="0">
98           <tr>
99             <td width=
"12%" align="center" bgcolor="#CCCCCC"><strong>No.</strong></td>
100             <td width=
"22%" bgcolor="#CCCCCC"><strong>Stock</strong></td>
101             <td width=
"18%" bgcolor="#CCCCCC"><strong>Quantity</strong></td>
102             <td width=
"19%" bgcolor="#CCCCCC"><strong>Rate</strong></td>
103             <td width=
"11%" bgcolor="#CCCCCC">&nbsp;</td>
104             <td width=
"18%" bgcolor="#CCCCCC"><strong>Total</strong></td>
105           </tr>
106           
107           <tr>
108             <td align=
"center">&nbsp;</td>
109             <td>&nbsp;</td>
110             <td>&nbsp;</td>
111             <td>&nbsp;</td>
112             <td>&nbsp;</td>
113             <td>&nbsp;</td>
114           </tr>
115           <?php
116           $i=
1;
117          $db->query(
"SELECT * FROM stock_sales where transactionid='$sid'");
118 while
($line3 = $db->fetchNextObject()) {
119 ?>
120           <tr>
121             <td align=
"center"><?php echo $i."."; ?></td>
122             <td><?php echo $line3->stock_name; ?></td>
123             <td><?php echo $line3->quantity; ?></td>
124             <td><?php echo $line3->selling_price; ?></td>
125             <td>&nbsp;</td>
126             <td><?php echo $line3->amount ; ?></td>
127           </tr>
128           
129           <?php
130     $i++;
131     $subtotal=$line3->subtotal;
132     $payment=$line3->payment;
133     $balance=$line3->balance;
134     $date=$line->due;
135 }
136           ?>
137           <tr>
138             <td>&nbsp;</td>
139             <td>&nbsp;</td>
140             <td>&nbsp;</td>
141             <td>&nbsp;</td>
142             <td>&nbsp;</td>
143             <td></td>
144           </tr>
145         </table></td>
146       </tr>
147       <tr>
148       <td><table width=
"100%" border="0" cellspacing="0" cellpadding="0">
149         <tr>
150           <td width=
"82%" align="right" bgcolor="#CCCCCC"><strong>SubTotal:&nbsp;&nbsp;</strong></td>
151           <td width=
"18%" bgcolor="#CCCCCC"><?php echo $subtotal; ?>&nbsp;</td>
152         </tr>
153       </table> </td>
154       </tr>
155       <tr>
156         <td align=
"right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
157           <tr>
158             <td width=
"33%" align="left" valign="top"><br />
159               <strong>&nbsp;&nbsp;Paid Amount :&nbsp;&nbsp;<?php echo $payment; ?><br />
160               &nbsp;&nbsp;Balance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;:&nbsp;&nbsp;<?php echo $balance; ?><br />
161               &nbsp;&nbsp;Due Date&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;: <?php
if($balance == 0) {
162               $mysqldate=$ldue;
163
164         $phpdate = strtotime( $mysqldate );
165
166         $phpdate = date(
"d/m/Y",$phpdate);}
167         echo $phpdate;?> <br />
168               </strong> </td>
169             <td width=
"67%" align="right"><br />
170               <br />
171               <br />
172               Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
173           </tr>
174         </table></td>
175       </tr>
176       <tr>
177         <td align=
"center" bgcolor="#CCCCCC">Thank you for Business with Us </td>
178       </tr>
179     </table></td>
180   </tr>
181 </table>
182
183
184 </body>
185 </html>
186 <?php
187 }

188 else
"Error in processing printing the sales receipt";
189 }
190 ?>


Gõ tìm kiếm nhanh...